<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of financialTotals
 *
 * @author nstevens
 */
class financialTotals {
    public $actualHourTotal, $actualDollarTotal, $proposedHourTotal, $proposedDollarTotal;
    
    public function __construct() {
        $this->actualDollarTotal = array(0,0,0,0);
        $this->actualHourTotal = array(0,0,0,0);
        $this->proposedDollarTotal = array(0,0,0,0);
        $this->proposedHourTotal = array(0,0,0,0);
    }
    
    /**
     * 
     * @param type $type hour or cost
     */
    public function getActualYearTotal($type){
        if(strcmp($type,"hour")===0){
            $array = $this->actualHourTotal;
        }
        else{
            $array = $this->actualDollarTotal;
        }
        return $this->sumUpArray($array);
    }
    
    public function getProposedYearTotal($type){
        if(strcmp($type,"hour")===0){
            $array = $this->proposedHourTotal;
        }
        else{
            $array = $this->proposedDollarTotal;
        }
        return $this->sumUpArray($array);
    }
    
    protected function sumUpArray($array){
        $total = 0;
        for($i=0; $i<sizeof($array); $i++){
            $total += $array[$i];
        }
        return $total;
    }
}

?>
